<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <style>
        html{
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }
        body{
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }
        .head{
            width: 100%;
            display: flex;
            align-items: center;
        }
       .content{
           width: 100%;
           height: 100%;
           padding: 0;
           margin: 0;
           background-image: url("img/timg.jpg");
       }
        .login_box{
            width: 100%;
            height: 80%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
        }
        .login_btn{
            width:100px;
            height: 30px;
            border: 1px #17acf6 solid;
            border-radius: 10px;
            justify-content: center;
            margin-top: 20px;
            align-items: center;
            display: flex;
            background-color: wheat;
        }
    </style>
</head>
<body>
 <div class="content">
     <div class="head">
         <h1 style="margin: auto;color: aliceblue">请登录</h1>
     </div>
     <div class="login_box">
         <div class="login_row">
             <span>账号：</span><input id="user_name" placeholder="请输入账号" />
         </div>
         <div class="login_row">
             <span>密码：</span><input id="pwd" type="password" placeholder="请输入密码"/>
         </div>
         <div class="login_btn" onclick="login()">
             <span style="font-size: 15px;color: cornflowerblue">登录</span>
         </div>
     </div>
 </div>
</body>
</html>
<script>
    function login() {
        var name=$("#user_name").val();
        var pwd=$("#pwd").val();
      $.post("http://localhost:8081/login",{username:name,password:pwd},
          function (res) {
           if (res.code===0){
              window.location.href="./success.html"
           } else{
               alert(res.msg)
           }
      });
    }
</script>
